import request from '@/utils/request'

// 查询设备列表
export function listEquipment(query) {
  return request({
    url: '/iot/equipment/list',
    method: 'get',
    params: query
  })
}

// 查询设备详细
export function getEquipment(id) {
  return request({
    url: '/iot/equipment/' + id,
    method: 'get'
  })
}

// 新增设备
export function addEquipment(data) {
  return request({
    url: '/iot/equipment',
    method: 'post',
    data: data
  })
}



export function getVideoUrl(deviceId) {
  let params = {deviceId:deviceId};
  return request({
    url: '/monitor/third/start',
    method: 'get',
    params
  })
}

export function getDeviceList() {
  return request({
    url: '/monitor/third/deviceList',
    method: 'get',
  })
}

// 修改设备
export function updateEquipment(data) {
  return request({
    url: '/iot/equipment',
    method: 'put',
    data: data
  })
}

// 删除设备
export function delEquipment(id) {
  return request({
    url: '/iot/equipment/' + id,
    method: 'delete'
  })
}

export function deviceControl(data){
  return request({
    url: '/monitor/third/control',
    method: 'post',
    data: data
  })
}
